import fetch from '@/utils/fetch'
export const updateImg = (data) => {
    const param = new FormData()
    data.forEach((img, index) => {
        param.append(img.name + index, img, img.name);
    });
    return fetch.post('/v1/image/upload', param)
}

export const getImageUrl = (imageKey, sex, baseURL) => {
    if (!imageKey && sex !== undefined) {
        return require(`../../assets/img/doctor-${sex || '0'}.jpg`);
    }
    /* eslint-disable */
    try {
        return `${baseURL || 'http://47.101.45.245:8878'}/v1/image/${imageKey}`;
    } catch (error) {
        throw error;
    }
    /* eslint-disable */
}
